package com.lx.zxs.controller;

import com.lx.zxs.entity.User;
import com.lx.zxs.entity.Video;
import com.lx.zxs.service.VideoService;
import com.lx.zxs.service.bVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/bvideo")
public class bVideoController {

    @Autowired
    bVideoService bVideoService;

    @RequestMapping("queryVideoByParms")
    public List<Video> queryVideoByParms(String keyWords, Integer id) {

        return bVideoService.queryVideoByParms(keyWords, id);
    }

    @RequestMapping("insertVideo")
    public int insertUser(String vtitle, String vtype, String poster, String vpath) {

        Video video = new Video();
        video.setvTitle(vtitle);
        video.setvType(vtype);
        video.setPoster(poster);
        video.setvPath(vpath);
        return bVideoService.insertVideo(video);
    }

    @RequestMapping("updateVideo")
    public int updateVideo(int id,  String vtitle, String vtype, String poster, String vpath) {
        Video video = new Video();
        video.setId(id);
        video.setvTitle(vtitle);
        video.setvType(vtype);
        video.setPoster(poster);
        video.setvPath(vpath);
        return bVideoService.updateVideo(video);
    }

    @RequestMapping("delVideo")
    public int delVideo(int id) {

        return bVideoService.delVideo(id);
    }
}
